<style type="text/css">
@import "/templates/admin/js/dataTables/css/demo_table.css";
</style>
<script type="text/javascript" src="/templates/admin/js/dataTables/js/jquery.dataTables.js"></script>

{if $TBODY_TD}

{literal} 
<script type="text/javascript">
	$(document).ready(function() {
		var NowWrapTable = $('.nowraptable').dataTable( {
			"sDom":'Rlfrtip',
			"bStateSave": true,
			"aaSorting" : [],
			"aoData": [			
{/literal}
	{foreach $CFG_FIELD.aoData.bSortable as $key => $bool}
		{if $bool eq "null"}null,
		{else}{literal}{"bSortable":{/literal} {$bool} {literal}},{/literal}{/if}
	{/foreach}
{literal}
			]
		});		
	});
</script> 
{/literal}
    
    <div id="confirm">{$CONFIRM}</div>
      {if $DESC_INFO}
      <ul class="message warning">
        <li>{$DESC_INFO}</li>
        <li class="close-bt"></li>
      </ul>
      {/if}
      <form action="?m={$ACT_NAME}&id={$smarty.get.id}&parent={$smarty.get.parent}" method="post" id="pages_form_change">
        <input type="hidden" name="subaction" value="updateitems" />
        <table cellpadding="0" cellspacing="0" border="0" class="nowraptable">
          <thead>
            <tr> {if $CFG_FIELD.edit}
              <th>&nbsp;</th>
              {/if}
              {if $CFG_FIELD.delete}
              <th><a href="javascript:void(0);" class="select_delete" rel="delinput_{$MODE}"><img title="удалить все записи" src="/templates/admin/img/icons/delete.png" /></a></th>
              {/if}
              {if $CFG_FIELD.por}
              <th>Порядок</th>
              {/if}       
              {foreach $CFG_FIELD.field_cfg as $k => $v}
              <th width="{$v.width}" title="{$v.name}">{$v.name}</th>
              {/foreach} </tr>
          </thead>
          <tbody>
          
          {foreach $TBODY_TD as $tbody_item_key => $tbody_item_value}
          <tr> {if $CFG_FIELD.edit}
            <td><a href="?m={$ACT_NAME}&id={$smarty.get.id}&parent={$smarty.get.parent}&type=edit&pageid={$tbody_item_value.id}" title="Редактировать" class="ui-helper-clearfix ui-state-default ui-corner-all"><span class="ui-icon ui-icon-pencil"></span></a></td>
            {/if}
            {if $CFG_FIELD.delete}
            <td><input type="checkbox" class="delinput_{$MODE} mini-switch-delete" name="del[]" value="{$tbody_item_value.id}" /></td>
            {/if}
            {if $CFG_FIELD.por}
            <td><input type="text" name="por[{$tbody_item_value.id}]" value="{$tbody_item_value.por}" size="3" class="por_input" /></td>
            {/if}    
            {if $CFG_FIELD.field_cfg}{foreach $CFG_FIELD.field_cfg as $k => $v}
            <td title="{if is_array($v.fieldname)}{foreach $v.fieldname as $k_sysname => $v_sysname}{$tbody_item_value[$v_sysname]} {/foreach}{else}{$tbody_item_value[{$v.fieldname}]|strip_tags}{/if}" {$v.attr}>{if $v.link}<a href="?m={$ACT_NAME}&id={$smarty.get.id}&parent={$smarty.get.parent}&type=edit&pageid={$tbody_item_value.id}{if $IS_ACTIVE_GROUP}&active_group={$ACTIVE_GROUP_ID}{/if}">{/if}{if is_array($v.fieldname)}{foreach $v.fieldname as $k_sysname => $v_sysname}{$tbody_item_value[$v_sysname]} {/foreach}{else}{$tbody_item_value[{$v.fieldname}]|strip_tags}{/if}{if $v.link}</a>{/if}</td>
            {/foreach}{/if} </tr>
          {/foreach}
            </tbody>
          
        </table>
        <div class="clear"></div>
        <a href="javascript:void(0);" class="ui_wo_buttons change_button ui-state-default ui-corner-all"><span class="ui-icon ui-icon-refresh"></span>Изменить</a>
      </form>     
{elseif $Field}
<form action="" method="post" enctype="multipart/form-data" id="form_submit" class="form_submit">
  {if $smarty.get.type eq "edit"}
  <input type="hidden" name="type" value="editt" />
  <input type="hidden" name="id" value="{$smarty.get.pageid}" />
  {else}
  <input type=hidden name="type" value="add" />
  {/if}
  <div id="admin_tabs_main_content"> 
    <!-- TABS_NAME -->
    <ul>
      <li><a href="#General">Общие</a></li>
    </ul>
    <!-- END TABS_NAME --> 
    <!-- ОБЩИЕ -->
    <div id="General">
      <div style="width:730px;"> {if $smarty.get.type eq "edit"}
        <p class="position_name">Запись создана</p>
        <p class="position_input">{$Field.date_create}
          <input type="hidden" name="date_create" value="{$Field.date_create}" />
        </p>
        <p class="position_name">Запись обновлена</p>
        <p class="position_input">{$Field.date_update}</p>
        {/if}
        <p class="position_name">Порядок</p>
        <p class="position_input">
          <input type="text" name="por" value="{$Field.por}" class="por-field">
        </p>
        <p class="position_name">Название</p>
        <p class="position_input">
          <input type="text" name="name" value="{$Field.name}">
        </p>
        <p class="position_name">Константа</p>
        <p class="position_input">
          <input type="text" name="const" value="{$Field.const}">
        </p>
        <p class="position_name">Значение</p>
        <p class="position_input">
          <textarea name="value">{$Field.value}</textarea>
        </p>
      </div>
    </div>
  </div>
  <div id="posbutton"> <a href="javascript:void(0);" class="ui_wo_buttons but_save ui-state-default ui-corner-all"><span class="ui-icon ui-icon-disk"></span>Сохранить</a> </div>
</form>
<script type="text/javascript">
$(function()
{
	$(".but_save").live("click", function(){
		$("#form_submit").attr("action", "?m=configuration&id={$smarty.get.id}&parent={$smarty.get.parent}").submit();
	});
});
</script> 
{else}
<div id="info_table" class="ui-state-error ui-corner-all">
  <p><span class="ui-icon ui-icon-alert" style="float:left;margin-right:.3em;"></span> <strong>Внимание!</strong> В выбранном разделе <strong>записей нет</strong></p>
</div>
{/if}